package com.ym.b2b.product.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ym.b2b.commons.controller.BaseController;
import com.ym.b2b.product.dao.EmBProductPaperBatchDAO;
import com.ym.b2b.product.service.EmBProductPaperBatchService;
import com.ym.b2b.product.sqlbean.EmBProductPaperBatch;
import com.zc.commons.base.Result;

@Controller
@RequestMapping("/product")
public class ManagerProductPaperBatch extends BaseController {

    @Autowired
    private EmBProductPaperBatchDAO     emBProductPaperBatchDAO;

    @Autowired
    private EmBProductPaperBatchService emBProductPaperBatchService;

    /**
     * 商品资料列表
     * 
     * @Title: searchEmBProductPaperBatch
     * @Description: TODO
     * @Param @param emBProductPaperBatch
     * @Param @param req
     * @Param @return
     * @Return Result
     * @Throws
     */
    @RequestMapping("searchEmBProductPaperBatch.do")
    @ResponseBody
    public Result searchEmBProductPaperBatch(EmBProductPaperBatch emBProductPaperBatch, HttpServletRequest req) {
        Result ret = new Result();
        try {
            List<EmBProductPaperBatch> list = emBProductPaperBatchDAO.searchEmBProductPaperBatch(emBProductPaperBatch);
            ret.setRows(list);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            ret.setCodeResult(Result.CODE_100, "查询异常");
        }
        return ret;
    }
    
    @RequestMapping({"getEmBProductPaperBatchList.s"})
    @ResponseBody
    public Result getEmBProductPaperBatchList(EmBProductPaperBatch emBProductPaperBatch, HttpServletRequest req)
    {
      Result ret = new Result();
      try {
        List list = this.emBProductPaperBatchDAO.searchEmBProductPaperBatch(emBProductPaperBatch);
        ret.setRows(list);
      } catch (Exception e) {
        this.logger.error(e.getMessage(), e);
        ret.setCodeResult("100", "查询异常");
      }
      return ret;
    }
    
    @RequestMapping("deleteEmBProductPaperBatch.do")
    @ResponseBody
    public Result deleteEmBProductPaperBatch(EmBProductPaperBatch emBProductPaperBatch, HttpServletRequest req) {
        Result ret = new Result();
        try {
            ret = emBProductPaperBatchService.deleteEmBProductPaperBatch(emBProductPaperBatch);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            ret.setCodeResult(Result.CODE_100, "删除异常");
        }
        return ret;
    }

    @RequestMapping("insertEmBProductPaperBatch.do")
    @ResponseBody
    public Result insertEmBProductPaperBatch(EmBProductPaperBatch emBProductPaperBatch, HttpServletRequest req) {
        Result ret = new Result();
        try {
            ret = emBProductPaperBatchService.insertEmBProductPaperBatch(emBProductPaperBatch);
        } catch (Exception e) {
            ret.setCodeResult(Result.CODE_100, e.getMessage());
        }
        return ret;
    }

    @RequestMapping("updateEmBProductPaperBatch.do")
    @ResponseBody
    public Result updateEmBProductPaperBatch(EmBProductPaperBatch emBProductPaperBatch, HttpServletRequest req) {
        Result ret = new Result();
        try {
            ret = emBProductPaperBatchService.updateEmBProductPaperBatch(emBProductPaperBatch);
        } catch (Exception e) {
            ret.setCodeResult(Result.CODE_100, e.getMessage());
        }
        return ret;
    }

}
